<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTableUserVipInfo extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_vip_infos', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->comment('用户id')->index();
            $table->integer('vip_base_info_id')->comment('会员信息id')->index();
            $table->string('vip_name')->comment('会员名称');
            $table->string('privilege_str',512)->comment('所有特权');
            $table->float('homework_help_discount',3,2)->default(1)->comment('作业帮折扣');
            $table->float('algorithm_sources_discount',3,2)->default(1)->comment('算法源码折扣');
            $table->float('resource_discount',3,2)->default(1)->comment('资源积分折扣');
            $table->tinyInteger('is_exempt_ads')->comment('是否面广告');
            $table->dateTime('start_date')->comment('会员购买时间');
            $table->dateTime('expire_date')->comment('会员到期时间时间');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('user_vip_infos');
    }
}
